﻿<phone:PhoneApplicationPage 
    x:Class="Simple_ToDo.Phone.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    shell:SystemTray.IsVisible="False" d:DesignHeight="728" d:DesignWidth="480" BackKeyPress="PhoneApplicationPage_BackKeyPress">

    <Grid x:Name="LayoutRoot" Background="Transparent">

        <StackPanel Name="AddTask" Visibility="Collapsed">
            <TextBlock Text="Task"/>
            <TextBox Name="txtTask" />
            <TextBlock Text="Project"/>
            <TextBox Name="txtProject"/>
            <TextBlock Text="Note"/>
            <TextBox Name="txtNote"/>
            <Button Name="btnAdd" Content="Save" Click="btnAdd_Click" />
        </StackPanel>
        
        <StackPanel Name="EditTask" Visibility="Collapsed">
            <TextBlock Text="Task"/>
            <TextBox Name="txtEditTask" />
            <TextBlock Text="Project"/>
            <TextBox Name="txtEditProject"/>
            <TextBlock Text="Note"/>
            <TextBox Name="txtEditNote"/>
            <Button Name="btnEdit" Content="Save" Click="btnEdit_Click"/>
        </StackPanel>
        
        <ListBox Name="listMain" Margin="0,0,-12,0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button x:Name="btnSelectCategory" Click="btnSelectCategory_Click" Content="{Binding}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <ListBox Name="listTasks" Margin="0,0,-12,0" Visibility="Collapsed">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Name="listTasksCheckBox" Checked="listTasksCheckBox_Checked"/>
                        <StackPanel>
                            <TextBlock Text="{Binding Path=Content}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                            <StackPanel Orientation="Horizontal" Margin="12,-6,12,0">
                                <TextBlock Text="{Binding Path=Project}" TextWrapping="Wrap"  Style="{StaticResource PhoneTextSubtleStyle}"/>
                                <TextBlock Text="{Binding Path=Priority}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <ListBox Name="listProjects" Margin="0,0,-12,0" Visibility="Collapsed">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Name="listProjectsCheckBox" Checked="listProjectsCheckBox_Checked" DataContext="{Binding ElementName=listProjectsProject, Path=Text}"/>
                        <TextBlock Name="listProjectsProject" Text="{Binding}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
            
        <ListBox Name="listNotes" Margin="0,0,-12,0" Visibility="Collapsed">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Name="listNotesCheckBox" Click="listNotesCheckBox_Click" DataContext="{Binding ElementName=listNotesNote, Path=Text}"/>
                        <TextBlock Name="listNotesNote" Text="{Binding}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
 
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Add Task" Click="ApplicationBarIconButton_Click"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Edit Task" Click="ApplicationBarIconButton_Click_1"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>